package hwconsumerosgi;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import osgi.common.services.job.client.AbstractJobService;

public class Hello1 extends AbstractJobService {

	protected Integer execucoes = 0;

	public Hello1() {
		super();

	}

	@Override
	public void execute(JobExecutionContext execContext)
			throws JobExecutionException {
		logger.info("execute(JobExecutionContext) - start");

		logger.warn("Hello World  ("+execucoes+")  - from " + this.getClass().getName());

		logger.warn("Parameters :");
		if (this.getConfigProperties() != null) {
			for (Object chave : this.getConfigProperties().keySet()) {
				String ch = chave.toString();
				logger.warn("   [" + ch + "," + this.getConfigProperty(ch)
						+ "]");
			}
		}else{
			logger.warn("configProperties NULL.");
		}
		
		
		execucoes = execucoes + 1;

		
		logger.info("execute(JobExecutionContext) - end");
	}

	@Override
	public String getCronExpression() {
		return "0/10 * * * * ?";
	}

}
